\n";
}
}
}
//Returns a dummy function call to inform Dreamweaver the type of certain behavior
//call arguments. This information is used by DW to fixup behavior args when the
//document is moved or changed.
//
//It is passed an actual function call string generated by applyBehavior(), which
//may have a variable list of arguments, and this should return a matching mask.
//
//The return values are:
// URL : argument could be a file path, which DW will update during Save As...
// NS4.0ref: arg is an object ref that may be changed by Convert Tables to Layers
// IE4.0ref: arg is an object ref that may be changed by Convert Tables to Layers
// other...: argument is ignored
function identifyBehaviorArguments(fnCallStr) {
var argList, argArray, numArgGroups, i;
argList = "";
argArray = extractArgs(fnCallStr);
numArgGroups = (argArray.length - 1) / 3; //args come in triplets
for (i=0; i i); //if preload, check box
document.MM_myImgSrcs = imgSrcArray; //save updated imageSrc list
displayImgSrc(); //load the imageSrc for selected image
}
//Used to improve performance, this hardcodes the expected window size. Without
//this fn, or if WINDOWSIZE_Autosize is true, DW will render the UI dynamically.
//IMPORTANT: for internationalization and other UI changes, update the globals.
function WindowDimensions(platform) {
if (!WINDOWSIZE_Autosize) {
if (platform.charAt(0) == "m" || platform.charAt(0) == "M") //if Mac
return WINDOWSIZE_Mac;
else //else Windows 95 or NT
return WINDOWSIZE_Win;
}
}
//***************** LOCAL FUNCTIONS ******************
//Load the select menu with image names.
//Also sets the global property MM_myImgSrcs to the right num of items.
function initializeUI(){
var niceNameSrcArray, nameArray, i, imgSrcArray = new Array(); //start global list
document.MM_NS_REFS = getObjectRefs("NS 4.0","document","IMG"); //store parallel NS refs
document.MM_IE_REFS = getObjectRefs("IE 4.0","document","IMG"); //store parallel IE refs
niceNameSrcArray = document.MM_NS_REFS;
//Search for unreferenceable objects. is IE only,
is NS only.
//if REF_CANNOT found, return empty string, and use IE refs for nice namelist.
for (i=0; i 0 && theStr.charAt(lastPos) == "'")
argArray[i] = theStr.substring(1,lastPos);
}
return argArray
}
//Given a string "myObject *" returns "myObject *".
function stripStar(theStr) {
var endPos;
endPos = theStr.indexOf(' *');
return ((endPos > 0)? theStr.substring(0,endPos) : theStr);
}
//Given theSelect obj and an index, it appends a star
//and inserts the new string into the menu at position index.
//If the menu item was "layer[2]" it becomes "layer[2] *".
//Existing " *" values get stripped off first.
function addStarToMenuItem(theSelect,menuIndex) {
var newMenuText;
newMenuText = stripStar(theSelect.options[menuIndex].text); //remove if old star
newMenuText += " *"; //append " *"
theSelect.options[menuIndex]=new Option(newMenuText); //add new line to menu
}
//Passed a string, finds special chars '"\ and escapes them with \
function escQuotes(theStr){
var i, theChar, escStr = "";
for(var i=0; i 1) {
niceRef = objTypeStr + ' ' + nameReduce(tokens[0]); //start building str, ie: image "foo"
if (tokens.length > 2) { //reference includes some nesting...
if (tokens[1] != "document") //inside a form so add form reference
niceRef += ' ' + TYPE_Separator + ' ' + TYPE_Form + ' ' + nameReduce(tokens[1]);
for (j=1; j "myImg"
// layers['foo'] => "foo"
// embeds[0] => 0
// myImg[2] => "myImg[2]"
function nameReduce (objName) {
var retVal, arrayTokens;
retVal = '"' + objName + '"'; //default is object wrapped in quotes
if (objName.indexOf("[") > 0) { //if it's an array
arrayTokens = getTokens(objName,"[]\"'"); //break up tokens
if (arrayTokens.length == 2) { //if exactly two tokens
if ("layers forms embeds links anchors all".indexOf(arrayTokens[0]) != -1) { //if legal
if (arrayTokens[1] == ""+parseInt(arrayTokens[1])) //if a number
retVal = arrayTokens[1];
else //else it's a string
retVal = '"' + arrayTokens[1] + '"';
}
}
}
return retVal;
}
//Emulates printf("blah blah %s blah %s",str1,str2)
//Used for concatenating error message for easier localization.
//Returns assembled string.
function errMsg() {
var i,numArgs,errStr="",argNum=0,startPos;
numArgs = errMsg.arguments.length;
if (numArgs) {
theStr = errMsg.arguments[argNum++];
startPos = 0; endPos = theStr.indexOf("%s",startPos);
if (endPos == -1) endPos = theStr.length;
while (startPos < theStr.length) {
errStr += theStr.substring(startPos,endPos);
if (argNum < numArgs) errStr += errMsg.arguments[argNum++];
startPos = endPos+2; endPos = theStr.indexOf("%s",startPos);
if (endPos == -1) endPos = theStr.length;
}
if (!errStr) errStr = errMsg.arguments[0];
}
return errStr;
}
//*************** END OF JAVASCRIPT *****************
behavior "Swap Image"